package com.fhz.shop.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.fhz.shop.R;

/**
 * 时间:2023/8/31
 *
 * @author Mr.Feng
 * 简述: 自定义搜索框
 */
public class FengSearchView extends LinearLayout {
    //new
    public FengSearchView(Context context) {
        this(context,null);
    }

    //xml
    public FengSearchView(Context context, @Nullable AttributeSet attrs) {
        this(context,attrs,0);
    }

    //xml
    public FengSearchView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        //加载一个布局
        TypedArray typedArray = context.obtainStyledAttributes(attrs,R.styleable.FengSearchView);

        View inflate = LayoutInflater.from(context).inflate(R.layout.widget_search_view_layout,this,false);
        String string = typedArray.getString(R.styleable.FengSearchView_searchText);
        TextView search = inflate.findViewById(R.id.widget_edit_text);
        search.setHint(string);

        addView(inflate);
        typedArray.recycle();


    }





}
